package com.jiayou.config.vertx.web

/**
@author lishuang
@data   2021-07-19  10:53:37
@info   vert-x web注解
 */

//handler的一级路由，类似spring-mvc的类注解的RequestMapping
annotation class RequestMapping(val basePath: String)

/**
 * @param path         ->  二级路由
 * @param responseType ->  返回类型  根据返回类型来判断response header
 * @param block ->         标识该请求是否为阻塞事件：
 *                                      false -> 声明方法体不会产生阻塞，可能会报ThreadBlock Exception （线程安全）
 *                                      true  -> 声明方法体可能会产生阻塞，不会报ThreadBlock Exception （线程不安全）
 */

annotation class Get(val path: String, val responseType: ResponseType = ResponseType.JSON, val block: Boolean = false)
annotation class Post(val path: String, val responseType: ResponseType = ResponseType.JSON, val block: Boolean = false)
annotation class Put(val path: String, val responseType: ResponseType = ResponseType.JSON, val block: Boolean = false)
annotation class Delete(val path: String, val responseType: ResponseType = ResponseType.JSON, val block: Boolean = false)


enum class ResponseType(val value: String) {
    TEXT("application/text"),
    JSON("application/json"),
    BYTE("application/byte")
}

